<!DOCTYPE html>
<html>

<head>
  <title>Implementing a gRPC Service</title>
  <script id="adobe_dtm" src="https://www.redhat.com/dtm.js" type="text/javascript"></script>
  <script src="/assets/javascript/highlight.pack.js" type="text/javascript"></script>
  <META HTTP-EQUIV='Content-Security-Policy' CONTENT="default-src 'none'; script-src 'self' 'unsafe-eval' 'sha256-ANpuoVzuSex6VhqpYgsG25OHWVA1I+F6aGU04LoI+5s=' 'sha256-ipy9P/3rZZW06mTLAR0EnXvxSNcnfSDPLDuh3kzbB1w=' js.bizographics.com https://www.redhat.com assets.adobedtm.com jsonip.com https://ajax.googleapis.com https://www.googletagmanager.com https://www.google-analytics.com https://use.fontawesome.com; style-src 'self' https://fonts.googleapis.com https://use.fontawesome.com; img-src 'self' *; media-src 'self' ; frame-src https://www.googletagmanager.com https://www.youtube.com; frame-ancestors 'none'; base-uri 'none'; object-src 'none'; form-action 'none'; font-src 'self' https://use.fontawesome.com https://fonts.gstatic.com;">
  <META HTTP-EQUIV='X-Frame-Options' CONTENT="DENY">
  <META HTTP-EQUIV='X-XSS-Protection' CONTENT="1; mode=block">
  <META HTTP-EQUIV='X-Content-Type-Options' CONTENT="nosniff">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="Quarkus: Supersonic Subatomic Java">
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="@QuarkusIO"> 
  <meta name="twitter:creator" content="@QuarkusIO">
  <meta property="og:url" content="https://quarkus.io/guides/grpc-service-implementation" />
  <meta property="og:title" content="Implementing a gRPC Service" />
  <meta property="og:description" content="Quarkus: Supersonic Subatomic Java" />
  <meta property="og:image" content="/assets/images/quarkus_card.png" />
  <link rel="canonical" href="https://quarkus.io/guides/grpc-service-implementation">
  <link rel="shortcut icon" type="image/png" href="/favicon.ico" >
  <link rel="stylesheet" href="https://quarkus.io/guides/stylesheet/config.css" />
  <link rel="stylesheet" href="/assets/css/main.css" />
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
  <link rel="alternate" type="application/rss+xml"  href="https://quarkus.io/feed.xml" title="Quarkus">
  <script src="https://quarkus.io/assets/javascript/goan.js" type="text/javascript"></script>
  <script src="https://quarkus.io/assets/javascript/hl.js" type="text/javascript"></script>
</head>

<body class="guides">
  <!-- Google Tag Manager (noscript) -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NJWS5L"
  height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  <!-- End Google Tag Manager (noscript) -->

  <div class="nav-wrapper">
  <div class="grid-wrapper">
    <div class="width-12-12">
      <input type="checkbox" id="checkbox" />
      <nav id="main-nav" class="main-nav">
  <div class="container">
    <div class="logo-wrapper">
      
        <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_600px_reverse.png" class="project-logo" title="Quarkus"></a>
      
    </div>
    <label class="nav-toggle" for="checkbox">
      <i class="fa fa-bars"></i>
    </label>
    <div id="menu" class="menu">
      <span>
        <a href="/get-started/" class="">Get Started</a>
      </span>
      <span>
        <a href="/guides/" class="active">Guides</a>
      </span>
      <span>
        <a href="/community/" class="">Community</a>
      </span>
      <span>
        <a href="/support/" class="">Support</a>
      </span>
      <span>
        <a href="/blog/" class="">Blog</a>
      </span>
      <span>
        <a href="https://code.quarkus.io" class="button-cta secondary white">Start Coding</a>
      </span>
    </div>
  </div>
      </nav>
    </div>
  </div>
</div>

  <div class="content">
    <div class="guide">
  <div class="width-12-12">
    <h1 class="text-caps">Implementing a gRPC Service</h1>
    <div class="hide-mobile toc"><ul class="sectlevel1">
<li><a href="#implementation-base">Implementation base</a></li>
<li><a href="#implementing-a-service-with-the-default-grpc-api">Implementing a service with the default gRPC API</a></li>
<li><a href="#implementing-a-service-with-the-mutiny-api">Implementing a service with the Mutiny API</a></li>
<li><a href="#handling-streams">Handling streams</a></li>
<li><a href="#health-check">Health check</a></li>
<li><a href="#reflection-service">Reflection Service</a></li>
<li><a href="#scaling">Scaling</a></li>
<li><a href="#server-configuration">Server configuration</a></li>
<li><a href="#example-of-configuration">Example of configuration</a>
<ul class="sectlevel2">
<li><a href="#enabling-tls">Enabling TLS</a></li>
<li><a href="#tls-with-mutual-auth">TLS with Mutual Auth</a></li>
</ul>
</li>
</ul></div>
    <div>
      <div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>gRPC service implementations exposed as beans are automatically registered and served by quarkus-grpc.</p>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
Implementing a gRPC service requires the gRPC classes to be generated.
Place your <code>proto</code> files in <code>src/main/proto</code> and run <code>mvn compile</code>.
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="implementation-base"><a class="anchor" href="#implementation-base"></a>Implementation base</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The generation has created 2 implementation bases:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>One using the default gRPC API</p>
</li>
<li>
<p>One using the Mutiny API</p>
</li>
</ol>
</div>
<div class="paragraph">
<p>The first classname is structured as follows: <code>${NAME_OF_THE_SERVICE}Grpc.${NAME_OF_THE_SERVICE}ImplBase</code>.
The second classname is structured as follows: <code>Mutiny${NAME_OF_THE_SERVICE}Grpc.${NAME_OF_THE_SERVICE}ImplBase</code>.</p>
</div>
<div class="paragraph">
<p>For example, if you use <code>Greeter</code> as service name as in:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">service Greeter {
    rpc SayHello (HelloRequest) returns (HelloReply) {}
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>The regular implementation base is: <code>GreeterGrpc.GreeterImplBase</code>.
The second implementation base is: <code>MutinyGreeterGrpc.GreeterImplBase</code>.</p>
</div>
<div class="paragraph">
<p>Note that these classes are not interfaces but regular classes.
When extending them, you need to override the service methods defined in the service definition.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="implementing-a-service-with-the-default-grpc-api"><a class="anchor" href="#implementing-a-service-with-the-default-grpc-api"></a>Implementing a service with the default gRPC API</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To implement a gRPC service using the default gRPC API, create a class extending the default implementation base.
Then, override the methods defined in the service interface.
Finally, expose the service as a CDI bean using the <code>@Singleton</code> annotation:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">import javax.inject.Singleton;

@Singleton
public class HelloService extends GreeterGrpc.GreeterImplBase {

    @Override
    public void sayHello(HelloRequest request, StreamObserver&lt;HelloReply&gt; responseObserver) {
        String name = request.getName();
        String message = "Hello " + name;
        responseObserver.onNext(HelloReply.newBuilder().setMessage(message).build());
        responseObserver.onCompleted();
    }
}</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="implementing-a-service-with-the-mutiny-api"><a class="anchor" href="#implementing-a-service-with-the-mutiny-api"></a>Implementing a service with the Mutiny API</h2>
<div class="sectionbody">
<div class="paragraph">
<p>To implement a gRPC service using the Mutiny gRPC API, create a class extending the Mutiny implementation base.
Then, override the methods defined in the service interface.
These methods are using Mutiny types.
Finally, expose the service as a CDI bean using the <code>@Singleton</code> annotation:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">import javax.inject.Singleton;

@Singleton
public class ReactiveHelloService extends MutinyGreeterGrpc.GreeterImplBase {

    @Override
    public Uni&lt;HelloReply&gt; sayHello(HelloRequest request) {
        return Uni.createFrom().item(() -&gt;
                HelloReply.newBuilder().setMessage("Hello " + request.getName()).build()
        );
    }
}</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="handling-streams"><a class="anchor" href="#handling-streams"></a>Handling streams</h2>
<div class="sectionbody">
<div class="paragraph">
<p>gRPC allows receiving and returning streams:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">service Streaming {
    rpc Source(Empty) returns (stream Item) {} // Returns a stream
    rpc Sink(stream Item) returns (Empty) {}   // Reads a stream
    rpc Pipe(stream Item) returns (stream Item) {}  // Reads a streams and return a streams
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>Using Mutiny, you can implement these as follows:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">@Singleton
public class StreamingService extends MutinyStreamingGrpc.StreamingImplBase {

    @Override
    public Multi&lt;Item&gt; source(Empty request) {
        // Just returns a stream emitting an item every 2ms and stopping after 10 items.
        return Multi.createFrom().ticks().every(Duration.ofMillis(2))
                .transform().byTakingFirstItems(10)
                .map(l -&gt; Item.newBuilder().setValue(Long.toString(l)).build());
    }

    @Override
    public Uni&lt;Empty&gt; sink(Multi&lt;Item&gt; request) {
        // Reads the incoming streams, consume all the items.
        return request
                .map(Item::getValue)
                .map(Long::parseLong)
                .collectItems().last()
                .map(l -&gt; Empty.newBuilder().build());
    }

    @Override
    public Multi&lt;Item&gt; pipe(Multi&lt;Item&gt; request) {
        // Reads the incoming stream, compute a sum and return the cumulative results
        // in the outbound stream.
        return request
                .map(Item::getValue)
                .map(Long::parseLong)
                .onItem().scan(() -&gt; 0L, Long::sum)
                .onItem().transform(l -&gt; Item.newBuilder().setValue(Long.toString(l)).build());
    }
}</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="health-check"><a class="anchor" href="#health-check"></a>Health check</h2>
<div class="sectionbody">
<div class="paragraph">
<p>For the exposed services, Quarkus gRPC exposes health information in the following format:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="protobuf" class="language-protobuf hljs">syntax = "proto3";

package grpc.health.v1;

message HealthCheckRequest {
  string service = 1;
}

message HealthCheckResponse {
  enum ServingStatus {
    UNKNOWN = 0;
    SERVING = 1;
    NOT_SERVING = 2;
  }
  ServingStatus status = 1;
}

service Health {
  rpc Check(HealthCheckRequest) returns (HealthCheckResponse);

  rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse);
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>Clients can specify the fully qualified service name to get the health status of a specific service
or skip specifying the service name to get the general status of the gRPC server.</p>
</div>
<div class="paragraph">
<p>For more details, check out the
<a href="https://github.com/grpc/grpc/blob/v1.28.1/doc/health-checking.md">gRPC documentation</a></p>
</div>
<div class="paragraph">
<p>Additionally, if Quarkus SmallRye Health is added to the application, a readiness check for
the state of the gRPC services will be added to the MicroProfile Health endpoint response, that is <code>/health</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="reflection-service"><a class="anchor" href="#reflection-service"></a>Reflection Service</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Quarkus gRPC Server implements the <a href="https://github.com/grpc/grpc/blob/master/doc/server-reflection.md">reflection service</a>.
This service allows tools like <a href="https://github.com/fullstorydev/grpcurl">grpcurl</a> or <a href="https://github.com/gusaul/grpcox">grpcox</a> to interact with your services.</p>
</div>
<div class="paragraph">
<p>The reflection service is enabled by default in <em>dev</em> mode.
In test or production mode, you need to enable it explicitly by setting <code>quarkus.grpc-server.enable-reflection-service</code> to <code>true</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="scaling"><a class="anchor" href="#scaling"></a>Scaling</h2>
<div class="sectionbody">
<div class="paragraph">
<p>By default, quarkus-grpc starts a single gRPC server running on a single event loop.</p>
</div>
<div class="paragraph">
<p>If you wish to scale your server, you can set the number of server instances by setting <code>quarkus.grpc.server.instances</code>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="server-configuration"><a class="anchor" href="#server-configuration"></a>Server configuration</h2>
<div class="sectionbody">
<div class="paragraph configuration-legend">
<p><span class="icon"><i class="fa fa-lock" title="Fixed at build time"></i></span> Configuration property fixed at build time - All other configuration properties are overridable at runtime</p>
</div>
<table class="tableblock frame-all grid-all stretch configuration-reference">
<colgroup>
<col style="width: 80%;">
<col style="width: 10%;">
<col style="width: 10%;">
</colgroup>
<tbody>
<tr>
<th class="tableblock halign-left valign-top"><p class="tableblock"><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server"></a><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server">Configure the gRPC server</a></p></th>
<th class="tableblock halign-left valign-middle"><p class="tableblock">Type</p></th>
<th class="tableblock halign-left valign-middle"><p class="tableblock">Default</p></th>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.port"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.port">quarkus.grpc.server.port</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The gRPC Server port.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>9000</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.host"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.host">quarkus.grpc.server.host</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The gRPC server host.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>0.0.0.0</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.handshake-timeout"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.handshake-timeout">quarkus.grpc.server.handshake-timeout</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The gRPC handshake timeout.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><a href="https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html">Duration</a>
  <a href="#duration-note-anchor" title="More information about the Duration format"><span class="icon"><i class="fa fa-question-circle"></i></span></a></p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.max-inbound-message-size"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.max-inbound-message-size">quarkus.grpc.server.max-inbound-message-size</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The max inbound message size in bytes.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.certificate"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.certificate">quarkus.grpc.server.ssl.certificate</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The file path to a server certificate or certificate chain in PEM format.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">path</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.key"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.key">quarkus.grpc.server.ssl.key</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The file path to the corresponding certificate private key file in PEM format.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">path</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.key-store"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.key-store">quarkus.grpc.server.ssl.key-store</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>An optional key store which holds the certificate information instead of specifying separate files.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">path</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.key-store-type"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.key-store-type">quarkus.grpc.server.ssl.key-store-type</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>An optional parameter to specify the type of the key store file. If not given, the type is automatically detected based on the file name.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.key-store-password"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.key-store-password">quarkus.grpc.server.ssl.key-store-password</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>A parameter to specify the password of the key store file. If not given, the default ("password") is used.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>password</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.trust-store"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.trust-store">quarkus.grpc.server.ssl.trust-store</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>An optional trust store which holds the certificate information of the certificates to trust</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">path</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.trust-store-type"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.trust-store-type">quarkus.grpc.server.ssl.trust-store-type</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>An optional parameter to specify type of the trust store file. If not given, the type is automatically detected based on the file name.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.trust-store-password"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.trust-store-password">quarkus.grpc.server.ssl.trust-store-password</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>A parameter to specify the password of the trust store file.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.cipher-suites"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.cipher-suites">quarkus.grpc.server.ssl.cipher-suites</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The cipher suites to use. If none is given, a reasonable default is selected.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">list of string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.protocols"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.protocols">quarkus.grpc.server.ssl.protocols</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The list of protocols to explicitly enable.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">list of string</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>TLSv1.3,TLSv1.2</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.client-auth"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.ssl.client-auth">quarkus.grpc.server.ssl.client-auth</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Configures the engine to require/request client authentication. NONE, REQUEST, REQUIRED</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>none</code>, <code>request</code>, <code>required</code></p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>none</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.plain-text"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.plain-text">quarkus.grpc.server.plain-text</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Disables SSL, and uses plain text instead. If disabled, configure the ssl configuration.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>true</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.alpn"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.alpn">quarkus.grpc.server.alpn</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Whether ALPN should be used.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>true</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.transport-security.certificate"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.transport-security.certificate">quarkus.grpc.server.transport-security.certificate</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The path to the certificate file.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.transport-security.key"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.transport-security.key">quarkus.grpc.server.transport-security.key</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>The path to the private key file.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-middle"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.enable-reflection-service"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.enable-reflection-service">quarkus.grpc.server.enable-reflection-service</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Enables the gRPC Reflection Service. By default, the reflection service is only exposed in <code>dev</code> mode. This setting allows overriding this choice and enable the reflection service every time.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">boolean</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>false</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><a id="quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.instances"></a><code><a href="#quarkus-grpc-config-group-config-grpc-server-configuration_quarkus.grpc.server.instances">quarkus.grpc.server.instances</a></code></p>
</div>
<div class="openblock description">
<div class="content">
<div class="paragraph">
<p>Number of gRPC server verticle instances. This is useful for scaling easily across multiple cores. The number should not exceed the amount of event loops.</p>
</div>
</div>
</div></div></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock">int</p></td>
<td class="tableblock halign-left valign-middle"><p class="tableblock"><code>1</code></p></td>
</tr>
</tbody>
</table>
<div id="duration-note-anchor" class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">About the Duration format</div>
<div class="paragraph">
<p>The format for durations uses the standard <code>java.time.Duration</code> format.
You can learn more about it in the <a href="https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence-">Duration#parse() javadoc</a>.</p>
</div>
<div class="paragraph">
<p>You can also provide duration values starting with a number.
In this case, if the value consists only of a number, the converter treats the value as seconds.
Otherwise, <code>PT</code> is implicitly prepended to the value to obtain a standard <code>java.time.Duration</code> format.</p>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="example-of-configuration"><a class="anchor" href="#example-of-configuration"></a>Example of configuration</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="enabling-tls"><a class="anchor" href="#enabling-tls"></a>Enabling TLS</h3>
<div class="paragraph">
<p>To enable TLS, use the following configuration:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">quarkus.grpc-server.ssl.certificate=src/main/resources/tls/server.pem
quarkus.grpc-server.ssl.key=src/main/resources/tls/server.key</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
When SSL/TLS is configured, <code>plain-text</code> is automatically disabled.
</td>
</tr>
</table>
</div>
</div>
<div class="sect2">
<h3 id="tls-with-mutual-auth"><a class="anchor" href="#tls-with-mutual-auth"></a>TLS with Mutual Auth</h3>
<div class="paragraph">
<p>To use TLS with mutual authentication, use the following configuration:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code class="language-none hljs">quarkus.grpc-server.ssl.certificate=src/main/resources/tls/server.pem
quarkus.grpc-server.ssl.key=src/main/resources/tls/server.key
quarkus.grpc-server.ssl.trust-store=src/main/resources/tls/ca.jks
quarkus.grpc-server.ssl.trust-store-password=*****
quarkus.grpc-server.ssl.client-auth=REQUIRED</code></pre>
</div>
</div>
</div>
</div>
</div>
    </div>
  </div>
</div>

  </div>

  <div class="content project-footer">
  <div class="footer-section">
    <div class="logo-wrapper">
      <a href="/"><img src="/assets/images/quarkus_logo_horizontal_rgb_reverse.svg" class="project-logo" title="Quarkus"></a>
    </div>
  </div>
  <div class="grid-wrapper">
    <p class="grid__item width-3-12">Quarkus is open. All dependencies of this project are available under the <a href='https://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache Software License 2.0</a> or compatible license.<br /><br />This website was built with <a href='https://jekyllrb.com/' target='_blank'>Jekyll</a>, is hosted on <a href='https://pages.github.com/' target='_blank'>Github Pages</a> and is completely open source. If you want to make it better, <a href='https://github.com/quarkusio/quarkusio.github.io' target='_blank'>fork the website</a> and show us what you’ve got.</p>

    
      <div class="width-1-12 project-links">
        <span>Navigation</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="/">Home</a></li>
          
            <li><a href="/guides">Guides</a></li>
          
            <li><a href="/community/#contributing">Contribute</a></li>
          
            <li><a href="/faq">FAQ</a></li>
          
            <li><a href="/get-started">Get Started</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Contribute</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://twitter.com/quarkusio">Follow us</a></li>
          
            <li><a href="https://github.com/quarkusio">GitHub</a></li>
          
            <li><a href="/security">Security&nbsp;policy</a></li>
          
        </ul>
      </div>
    
      <div class="width-1-12 project-links">
        <span>Get Help</span>
        <ul class="footer-links width-1-12">
          
            <li><a href="https://groups.google.com/forum/#!forum/quarkus-dev">Forums</a></li>
          
            <li><a href="https://quarkusio.zulipchat.com">Chatroom</a></li>
          
        </ul>
      </div>
    

    
      <div class="width-3-12 more-links">
        <span>Quarkus is made of community projects</span>
        <ul class="footer-links">
          
            <li><a href="https://vertx.io/" target="_blank">Eclipse Vert.x</a></li>
          
            <li><a href="https://microprofile.io" target="_blank">Eclipse MicroProfile</a></li>
          
            <li><a href="https://hibernate.org" target="_blank">Hibernate</a></li>
          
            <li><a href="https://netty.io" target="_blank">Netty</a></li>
          
            <li><a href="https://resteasy.github.io" target="_blank">RESTEasy</a></li>
          
            <li><a href="https://camel.apache.org" target="_blank">Apache Camel</a></li>
          
            <li><a href="https://code.quarkus.io/" target="_blank">And many more...</a></li>
          
        </ul>
      </div>
    
  </div>
</div>
  <div class="content redhat-footer">
  <div class="grid-wrapper">
    <span class="licence">
      <i class="fab fa-creative-commons"></i><i class="fab fa-creative-commons-by"></i> <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC by 3.0</a> | <a href="https://www.redhat.com/en/about/privacy-policy">Privacy Policy</a>
    </span>
    <span class="redhat">
      Sponsored by
    </span>
    <span class="redhat-logo">
      <a href="https://www.redhat.com/" target="_blank"><img src="/assets/images/redhat_reversed.svg"></a>
    </span>
  </div>
</div>


  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" integrity="sha384-8gBf6Y4YYq7Jx97PIqmTwLPin4hxIzQw5aDmUg/DDhul9fFpbbLcLh3nTIIDJKhx" crossorigin="anonymous"></script>
  <script type="text/javascript" src="/assets/javascript/mobile-nav.js"></script>
  <script type="text/javascript" src="/assets/javascript/scroll-down.js"></script>
  <script src="/assets/javascript/satellite.js" type="text/javascript"></script>
  <script src="https://quarkus.io/guides/javascript/config.js" type="text/javascript"></script>
  <script src="/assets/javascript/search-filter.js" type="text/javascript"></script>
  <script src="/assets/javascript/back-to-top.js" type="text/javascript"></script>
</body>

</html>
